package com.ujiuye.request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/rd5")
public class RequestDemo4 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //存值
        req.setAttribute("omg","这个域对象很骚"); //omg = key   value= 这个域对象很骚
         //取值
        Object omg = req.getAttribute("omg");
        System.out.println(omg);//这个域对象很骚
        //删除值
        req.removeAttribute("omg");
        String  omg1 = (String)req.getAttribute("omg");
        System.out.println(omg1);

    }
}
